package com.wingsfrog.travel.modules.entity;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by rankin on 16/3/30.
 */
@Entity
@Table(name = "t_task", schema = "", catalog = "travel")
public class Task {
    private int id;
    private int mainTaskId;
    private String taskName;
    private String taskDescription;
    private Byte enabled;
    private int taskType;
    private int taskScore;
    private int sequence;
    private String checkpoint;
    private Timestamp createdAt;
    private Timestamp updatedAt;
    private String createBy;
    private String updateBy;
    private Boolean isTeamTask;

    @Id
    @Column(name = "id")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "main_task_id",length = 11)
    public int getMainTaskId() {
        return mainTaskId;
    }

    public void setMainTaskId(int mainTaskId) {
        this.mainTaskId = mainTaskId;
    }

    @Column
    public Boolean getIsTeamTask() {
        return isTeamTask;
    }

    public void setIsTeamTask(Boolean isTeamTask) {
        this.isTeamTask = isTeamTask;
    }

    @Basic
    @Column(name = "task_name")
    public String getTaskName() {
        return taskName;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    @Basic
    @Column(name = "task_description")
    public String getTaskDescription() {
        return taskDescription;
    }

    public void setTaskDescription(String taskDescription) {
        this.taskDescription = taskDescription;
    }

    @Basic
    @Column(name = "enabled")
    public Byte getEnabled() {
        return enabled;
    }

    public void setEnabled(Byte enabled) {
        this.enabled = enabled;
    }

    @Basic
    @Column(name = "task_type")
    public int getTaskType() {
        return taskType;
    }

    public void setTaskType(int taskType) {
        this.taskType = taskType;
    }

    @Basic
    @Column(name = "task_score")
    public int getTaskScore() {
        return taskScore;
    }

    public void setTaskScore(int taskScore) {
        this.taskScore = taskScore;
    }

    @Basic
    @Column(name = "sequence")
    public int getSequence() {
        return sequence;
    }

    public void setSequence(int sequence) {
        this.sequence = sequence;
    }

    @Basic
    @Column(name = "checkpoint")
    public String getCheckpoint() {
        return checkpoint;
    }

    public void setCheckpoint(String checkpoint) {
        this.checkpoint = checkpoint;
    }

    @Basic
    @Column(name = "created_at")
    public Timestamp getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Timestamp createdAt) {
        this.createdAt = createdAt;
    }

    @Basic
    @Column(name = "updated_at")
    public Timestamp getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Timestamp updatedAt) {
        this.updatedAt = updatedAt;
    }

    @Basic
    @Column(name = "create_by")
    public String getCreateBy() {
        return createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    @Basic
    @Column(name = "update_by")
    public String getUpdateBy() {
        return updateBy;
    }

    public void setUpdateBy(String updateBy) {
        this.updateBy = updateBy;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Task task = (Task) o;

        if (id != task.id) return false;
        if (taskType != task.taskType) return false;
        if (taskScore != task.taskScore) return false;
        if (sequence != task.sequence) return false;
        if (taskName != null ? !taskName.equals(task.taskName) : task.taskName != null) return false;
        if (taskDescription != null ? !taskDescription.equals(task.taskDescription) : task.taskDescription != null)
            return false;
        if (enabled != null ? !enabled.equals(task.enabled) : task.enabled != null) return false;
        if (checkpoint != null ? !checkpoint.equals(task.checkpoint) : task.checkpoint != null) return false;
        if (createdAt != null ? !createdAt.equals(task.createdAt) : task.createdAt != null) return false;
        if (updatedAt != null ? !updatedAt.equals(task.updatedAt) : task.updatedAt != null) return false;
        if (createBy != null ? !createBy.equals(task.createBy) : task.createBy != null) return false;
        if (updateBy != null ? !updateBy.equals(task.updateBy) : task.updateBy != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (taskName != null ? taskName.hashCode() : 0);
        result = 31 * result + (taskDescription != null ? taskDescription.hashCode() : 0);
        result = 31 * result + (enabled != null ? enabled.hashCode() : 0);
        result = 31 * result + taskType;
        result = 31 * result + taskScore;
        result = 31 * result + sequence;
        result = 31 * result + (checkpoint != null ? checkpoint.hashCode() : 0);
        result = 31 * result + (createdAt != null ? createdAt.hashCode() : 0);
        result = 31 * result + (updatedAt != null ? updatedAt.hashCode() : 0);
        result = 31 * result + (createBy != null ? createBy.hashCode() : 0);
        result = 31 * result + (updateBy != null ? updateBy.hashCode() : 0);
        return result;
    }
}
